import Vue from 'vue'
import VueRouter from 'vue-router'

const Home = () => import('../views/home/Home')
const Find = () => import('../views/find/Find')
const Message = () => import('../views/message/Message')
const Profile = () => import('../views/profile/Profile')
const L_R = () => import('../views/l_r/L_R')
const Login = () => import('../views/l_r/childComps/Login')
const Register = () => import('../views/l_r/childComps/Register')
const ChatRoom = () => import('views/message/childComps/ChatRoom')
const EditInform = () => import('views/profile/profileChild/user/editInform/EditInform')
const EditProfileName = () => import('views/profile/profileChild/user/editInform/editInformChild/EditProfileName')
const AddFriends = () => import('views/message/childComps/AddFriends')
const Recommendation = () => import('@/views/find/findChild/Recommendation.vue')
const TourCircle = () => import('@/views/find/findChild/TourCircle.vue')
const SelectShare = () => import('@/views/publish/SelectShare.vue')
const EditPublish = () => import('@/views/publish/EditPublish.vue')
const PictureShow = () => import('@/views/publish/PictureShow.vue')
const RouteShow = () => import('@/views/publish/RouteShow.vue')
const blogDetail = () => import('@/views/find/findChild/blogDetail')
const ScenicDetail = () => import('@/views/home/homechild/ScenicDetail.vue')
const RouteList = () => import('@/views/home/homechild/RouteList.vue')
// const RouteDetail = () => import('@/views/home/homechild/RouteDetail.vue')


// 1.安装插件
Vue.use(VueRouter)

// 2.创建router
const routes = [
  // 设置页面默认路由配对
  {
    path: '',
    redirect: '/home'
  },
  // 设置首页页面路由配对
  {
    path: '/home',
    component: Home,
  },
  // 设置发现页面路由配对
  {
    path: '/find',
    component: Find,
    children:[
      {
        path: '',
        redirect: 'recommendation'
      },
      {
        path: 'recommendation',
        component: Recommendation
      },
      {
        path: 'tourCircle',
        component: TourCircle
      },
    ]
  },
  // 设置消息页面路由配对
  {
    path: '/message',
    component: Message,

  },
  // 设置我的页面路由配对
  {
    path: '/profile',
    component: Profile
  },

  {
    path: '/editInform',
    component: EditInform,
    children:[
      {
        path: 'EditProfileName',
        component: EditProfileName,
      }
    ]
  },
  // 设置登录注册页面路由配对
  {
    path: '/l_r',
    component: L_R,
    children: [
      {
        path: '/l_r',
        redirect: 'login'
      },
      {
        path: 'login',
        component: Login,
      },
      {
        path: 'register',
        component: Register
      }
    ]
  },
  // 设置聊天室页面路由配对
  {
    path: '/messagedetail',
    component: ChatRoom
  },
  // 设置添加好友页面路由配对
  {
    path: '/addfriends',
    component: AddFriends
  },
  // 设置旅游圈发布选择分享内容页面路由配对
  {
    path: '/selectShare',
    component: SelectShare,
    children: [
      {
        path: '/selectShare',
        redirect: 'locatedPicture'
      },
      // 选择本地图片页面路由配对
      {
        path: 'locatedPicture',
        component: PictureShow
      },
      // 选择旅游路线页面路由配对 
      {
        path: 'tourRoute',
        component: RouteShow
      }
    ]
  },
  // 编辑旅游圈
  {
    path: '/editPublish',
    component:EditPublish
  },
  //帖子详情
  {
    path: '/blogDetail',
    component: blogDetail
  },
  // 景点详情
  {
    path: '/scenicDetail/:region',
    component: ScenicDetail,
  },
  // 路线详情页
  {
    path: '/routeList',
    component: RouteList
  }
]

const router = new VueRouter({
  routes,
  mode: 'history',
  linkActiveClass: 'active'
})

export default router

